<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><head><title>Programming - Creating a Database</title>

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="expires" content="" />
<meta name="lang" content="en-US" />
<meta name="template-info" content="topic.htm 2012-03-19 usp" />
<meta name="creation-date" scheme="iso8601" content="2013-06-23" />
<meta name="last-modified" scheme="iso8601" content="2013-06-23" />
<meta name="publish-date" scheme="iso8601" content="" />
<meta name="version" content="1" />
<meta name="author" content="USP" />
<meta name="robots" content="follow" />
<meta name="category" content="Programming/Database/Firebird" />
<meta name="keywords" content="programming, database, Firebird, SQL, documentation." />
<meta name="description" content="" />

<link rel="stylesheet" type="text/css" href="../../../includes/topic-2.css" />
<link rel="stylesheet" type="text/css" href="../../../includes/sourcecode.css" />
<link rel="stylesheet" type="text/css" href="../local.css" />

<script language="JavaScript" type="text/javascript" src="../../../includes/global.js"></script>
<script language="JavaScript" type="text/javascript" src="../../../includes/cookies.js"></script>
<script language="JavaScript" type="text/javascript" src="../../../includes/topic.js"></script>

</head><body class="content" onload="onloadTopic()"><a name="top"></a>

<h1>Creating a Database</h1>

<p>This will be second step after setting up the database server - creating a database.</p>

<pre class="codebox">
private string hostname = "localhost";
private string databaseFileName = "c:\\data\\demo-db.fdb";

FbConnectionStringBuilder dbconnectionStringBuilder;
FbConnection dbconnection;

void CreateDatabase ( )
{
    <span class="comment">// Use a FbConnection to create the database. </span>
    if ( this.dbconnectionStringBuilder == null ) this.CreateConnectionStringBuilder( );
    dbconnectionStringBuilder.Charset = "UTF8";
    FbConnection.CreateDatabase ( 
        this.dbconnectionStringBuilder.ConnectionString
        );
    <span class="comment">// Re-create the intended filename casing. </span>
    System.IO.File.Move( this.databaseFileName, this.databaseFileName );
}
</pre>

<p>NOTES: The database name will be created in uppercase letters. I did not find a way to prevent it (either the Firebird server or the DotNET Data Provider) from converting the strings &mdash; hence the mysterious copy operation at the end.</p>

<div class="footer"><hr />
<p>Page author: USP &bull; Page editor: USP &bull; Last update: 2013-06-06 &bull; 1</p>
<p>&copy; 2013 Synesis Ulrich Sprick. All rights reserved. See <a href="../../../copyright.htm">Copyright details</a>.</p>
<p><a href="#top">Back to Top</a> | <a href="../../../index.htm" target="_top">Home</a> | <a id="reload" onclick="reloadFrameset()" href ="../../../index.htm" target="_top" >Reload Frameset</a></p>
</div></body></html>
